﻿using SIG.DAL.Dapper.Repositories;
using SIG.Infrastructure.Configs;
using SIG.ViewModel.Admin.Menu;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SIG.WebMVC.Areas.Admin.Controllers
{
    public class NavController : BaseController
    {
        MenuRepository _menuRepository;
        public NavController()
        {
            _menuRepository = new MenuRepository();

        }

        // GET: Admin/Nav
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 面包屑
        /// </summary>
        [AllowAnonymous]
        public ActionResult Crumbs(string areaName, string controller, string action)
        {
            return PartialView("_Crumbs", _menuRepository.CurrenMenuCrumbs(SettingsManager.Menu.BackMenuCId));
        }

        [AllowAnonymous]
        public ActionResult LeftNavs(int categoryId)
        {

            LeftNavVM vm = new LeftNavVM
            {
                Menus = _menuRepository.GetShowMenus(categoryId),
                CurrentMenu = _menuRepository.GetCurrenMenu()
            };

            return PartialView("_LeftNav", vm);


        }
    }
}